<?php namespace Zders\CustomTools;

use System\Classes\PluginBase;
use Zders\Customtools\FormWidgets\BaiduMapLocation;
use Zders\Customtools\Classes\Traits\RowBoot;
use Zders\Customtools\ListColumns\RowCheckBox;
use Zders\Customtools\ListColumns\RowEdit;
use Zders\Customtools\ListColumns\RowSwitch;
use Zders\Customtools\ListColumns\RowRadio;

/**
 * sidenav Plugin Information File
 */
class Plugin extends PluginBase
{
    use RowBoot;

    public function registerFormWidgets()
    {
        return [
            BaiduMapLocation::class => 'map_location',
        ];
    }

    public function registerListColumnTypes()
    {
        return [
            'row_switch' => [$this, 'eavlRowSwitchListColumn'],
            'row_edit' => [$this, 'eavlRowEditlistColumn'],
            'row_radio' => [$this, 'eavlRowRadiolistColumn'],
            'row_checkbox' => [$this, 'eavlRowChecklistColumn']
        ];
    }

    public function eavlRowSwitchListColumn($value, $column, $record)
    {
        return RowSwitch::prepareVars($value, $column, $record)->render();
    }

    public function eavlRowEditlistColumn($value, $column, $record)
    {
        return RowEdit::prepareVars($value, $column, $record)->render();
    }

    public function eavlRowRadiolistColumn($value, $column, $record)
    {
        return RowRadio::prepareVars($value, $column, $record)->render();
    }
    public function eavlRowChecklistColumn($value, $column, $record)
    {
        return RowCheckBox::prepareVars($value, $column, $record)->render();
    }

    public function registerSettings()
    {
        return [
            'config' => [
                'label'       => 'zders.customtools::lang.setting_name',
                'icon'        => 'wn-icon-instagram',
                'description' => 'zders.customtools::lang.setting_desription',
                'class'       => 'Zders\Customtools\Models\Settings',
                'permissions' => '',
                'order'       => 602
            ]
        ];
    }
}
